<?php
namespace app\index\controller;
use think\Controller;
use think\Request;
use SimpleXMLElement;

class Common extends Controller
{	
	public function _initialize(){
			if (!is_file(APP_PATH.'common/install.lock')) {	
				header("Location: /index.php/install/index");
				exit;
			}			
			//设置配置文件
			$config = model("common/Config")->getConfig();			
			config($config);					
				
			//站点状态	
			if(config('webstatus')==0){
				exit(config('webclosedesc'));
			}			
			      		
			//判断是否移动端
			$url = $_SERVER['HTTP_HOST'];
			if(config('webmstatus') == 1){
				if($url == config('webmurl') && config('weburltype')){
					header('Location:http://'.config('webmurl').'/m');	
                    exit;
				}
				if($url == config('webmurl') && !config('weburltype')){
					config('webthemes',config('webmthemes'));	
				}
				if(isMobile()){
					if(config('webmurl') != ""  && config('weburltype')){
						header('Location:http://'.config('webmurl'));
                      	exit;
					}
					config('webthemes',config('webmthemes'));
				}
			}								
			spider(); //蜘蛛爬虫	
			$this->assign('weburltype',config('weburltype'));
			$this->assign('webmurl',config('webmurl'));	
			$this->assign("nav",nav());		
    }
}
